package com.hanbang.taitaigou.utils.http;


import com.hanbang.taitaigou.model.UserInforData;

import org.xutils.common.util.KeyValue;
import org.xutils.http.RequestParams;
import org.xutils.http.annotation.HttpRequest;

import java.util.List;

/**
 * Created by Administrator on 2015/12/25.
 */
@HttpRequest(host = HttpInterfaces.ORG, path = HttpInterfaces.API)
public class HttpRequestParams extends RequestParams {
    public HttpRequestParams(String action) {
        addBodyParameter("action", action);
    }

    public HttpRequestParams() {
    }

    public void addPhoneParams(UserInforData data) {
        addBodyParameter("dept_id", data == null ? "" : data.getMobile());
    }

    public void addPasswordParams(UserInforData data) {
        addBodyParameter("title", data == null ? "" : data.getPassword());
    }
    public void addUserId(UserInforData data) {
        addBodyParameter("User_id", data == null ? "" : String.valueOf(data.getUser_id()));
    }
    public void addPhoneAndPassParams(UserInforData data) {
        addPhoneParams(data);
        addPasswordParams(data);
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append(super.toString());
        List<KeyValue> result = getStringParams();
        result.addAll(getFileParams());
        for (KeyValue kv : result) {
            sb.append(kv.toString() + "  ");
        }
        return sb.toString();
    }



}
